extends Node2D
class_name States

class idle_state :
	var actor
	func _init(_actor) -> void :
		actor = _actor

	func _on_enter(state : int) -> void :
		actor.rpc("_play_anim",state)

	func _on_process(_delta: float) -> void :
		if Input.is_action_just_released("attack") : actor._attack()

	func _on_physics_process(_delta: float) -> void : pass

	func _on_anim_finished(_anim_name: StringName) -> void : pass

	func _on_exit() -> void : pass

class run_state :
	var actor
	func _init(_actor) -> void :
		actor = _actor

	func _on_enter(state : int) -> void :
		actor.rpc("_play_anim",state) 

	func _on_process(_delta: float) -> void :
		if Input.is_action_just_released("attack") : actor._attack()

	func _on_physics_process(_delta: float) -> void : pass

	func _on_anim_finished(_anim_name: StringName) -> void : pass

	func _on_exit() -> void : pass

class attack_state :
	var actor
	func _init(_actor) -> void :
		actor = _actor

	func _on_enter(state : int) -> void :
		actor.is_attacking = true
		actor.rpc("_play_anim",state) 

	func _on_process(_delta: float) -> void :
		if Input.is_action_just_released("attack") : actor._attack()
	func _on_physics_process(_delta: float) -> void : pass

	func _on_anim_finished(_anim_name: StringName) -> void :
		actor.is_attacking = false
	func _on_exit() -> void : pass

class jump_state :
	var actor
	func _init(_actor) -> void :
		actor = _actor

	func _on_enter(state : int) -> void :
		if is_same(actor.last_state,state) : return
		actor.rpc("_play_anim",state) 

	func _on_process(_delta: float) -> void : pass

	func _on_physics_process(_delta: float) -> void : pass

	func _on_anim_finished(_anim_name: StringName) -> void : pass
	func _on_exit() -> void : pass
